import 'package:flutter/material.dart';
import 'package:xws/helpers/as_t.dart';
import 'package:xws/utils/theme_util.dart';

class FriendAddObj {
  FriendAddObj.fromJson(Map<String, dynamic> d) {
    avatarUrl = asT<String>(d['avatarUrl']);
    nickName = asT<String>(d['nickName']);
    userId = asT<String>(d['userId']);
  }

  late String avatarUrl;
  late String nickName;
  late String userId;
}

/// 好友添加信息
class FriendAdd extends StatelessWidget {
  const FriendAdd({Key? key, required this.addObj}) : super(key: key);

  final FriendAddObj addObj;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(20.0),
      child: Row(
        children: <Widget>[
          Expanded(
            child: RichText(
              text: TextSpan(
                style: TextStyle(fontSize: 14, color: black(context)),
                text: '用户 ',
                children: <TextSpan>[
                  TextSpan(
                    style: TextStyle(color: theme(context), fontWeight: FontWeight.bold),
                    text: addObj.nickName,
                  ),
                  const TextSpan(text: ' 关注了你'),
                ],
              ),
            ),
          ),
          const Icon(
            Icons.arrow_forward_ios_rounded,
            size: 14,
          ),
        ],
      ),
    );
  }
}
